<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <!-- 有序数组中出现次数超过百分之二十五的元素 -->
    <script>
      var findSpecialInteger = function (arr) {
        if (arr.length <= 3) return arr[0]
        let num = Math.ceil(arr.length * 0.25)
        let num1 = 0
        for (let i = 0; i < arr.length - 1; i++) {
          arr[i] === arr[i + 1] ? num1++ : (num1 = 0)
          if (num === num1) {
            return arr[i]
          }
        }
      }
      console.log(findSpecialInteger([1, 2, 2, 6, 6, 6, 6, 7, 10]))
    </script>
  </body>
</html>
